package com.singzi.leetcode.N100;
import java.util.ArrayList;
import java.util.List;

public class T0078 {

    public static void main(String[] args) {
        int []nums = {1,2,3,4,5,6,7,8};
        Solution0078 solution0087 = new Solution0078();
        System.out.println(solution0087.subsets(nums));

    }
}

class Solution0078 {
    private List<List<Integer>> result = new ArrayList<>();
    private List<Integer> temp = new ArrayList<>();
    public List<List<Integer>> subsets(int[] nums) {


        addList(nums,0);

        return result;

    }
    public void addList(int[] nums, int index){

        result.add(new ArrayList<>(temp));
        for (int i = index; i < nums.length; i++) {
            temp.add(nums[i]);
            addList(nums,  i+1);
            temp.remove(temp.size()-1);
        }


    }
}
